#include <stdio.h>
#include <string.h>
#include "debug.h"
//#include "color.h"
/**
********************************************************************************
Copyright (c) 2017, Huizhou Desay SV Automotive Co., Ltd. All rights reserved.
@file 			main.c
@author 		Linhao
@version 		v1.0
@data			2017/7/28
@brief			common test
@note		version		data		name	changes and comments
---------	--------	-----		----	------------------------
@note		v1.0		2017.7.28	LH		create file
********************************************************************************
**/



typedef struct date
{
	int year;
	int month;
	int day;
	
}DATE;



/**
 * @param         [in] date
 * @return        no value
 * @retval        
 * @note          Verify the date format 
 **/
void Verify_Format(DATE date, char *buf)
{

	if(date.month < 0 || date.month > 12 )
	{
		DEBUG("Error!!!Please check the month param.....");
		return;
	}

	if(date.day <= 0 || date.day > 31)
	{

		DEBUG("Error!!!Please check the day param.....");
		return;
	}

	if(strstr(buf, "-") == NULL)
	{
		DEBUG("Error!!!Please check the buff param......");
		return;
	}


	return;
	
}

int main(int argc, char *argv[])
{
	DATE date;

	int sum=0;
	int leap=0;
	char buf[20] = {0};

	printf("\nplease input year, month, day, example:2017-7-21\n");
	scanf("%d-%d-%d", &(date.year), &(date.month), &(date.day));
	
	sprintf(buf, "%d-%d-%d", date.year, date.month, date.day);
	
	Verify_Format(date, buf);

	DEBUG("buf is %s", buf);


	return 0;
}
